<?php
	require_once "weixin_info.php";
	require_once "config.php";
	$id = $_GET['id'];
	$deta_sql = $mysql->query('select * from dyspw_shop_detailed where id = '.$id);
	$deta = $deta_sql->fetch_all(MYSQLI_ASSOC);
	$order_sql =  $mysql->query('select * from dyspw_goods_order where id = '.$deta[0]['o_id']);
	$order = $order_sql->fetch_all(MYSQLI_ASSOC);
	// print_r(json_decode($order[0]['order_details'])) ;exit;
	if(!empty($order[0]['order_details'])){
		$order_details = json_decode($order[0]['order_details'], true);
	}
	$goods_sql = $mysql->query('select * from dyspw_goods where id = '.$order[0]['goods_id']);
	$goods = $goods_sql->fetch_all(MYSQLI_ASSOC);
 ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover">
    <title>收入详情</title>
    <!-- 引入组件库 -->
    <link rel="stylesheet" href="./lib-Jin/vant-index.css">
    <script src="./lib-Jin/vue.min.js"></script>
    <script src="./lib-Jin/vant-index.js"></script>
    <link rel="stylesheet" href="./lib-Jin/all.css">
    <link rel="stylesheet" href="./css/mingxi.css">
</head>
<body>
    <div id="app">
        <div class="top">
            <div class="back" @click="back">
                <img src="./images/back1.png">
            </div>
            收入详情
        </div>
        <div style="height: calc(100vh - 1rem);overflow-y: auto;">
            <div class="kong"></div>
            <div style="padding: 0 .6rem;box-sizing: border-box;">
                <div class="detail-head">
                    <div>
                        <img src="<?php echo $deta[0]['goods_img'] ?>">
                    </div>
                    <div style="font-size: .3rem;color: #000;font-weight: bold;margin-top: .18rem;">
                        <?php echo $deta[0]['goods_name'] ?>
                    </div>
                </div>
            </div>
            <div class="goods-list">
				<?php if(!empty($order_details)){ ?>
					<?php foreach ($order_details as $key => $val) { ?>
						<div class="list-log1">
		                    <img src="<?php echo $val['img']; ?>" style="width: 1.1rem;height: 1.1rem;border-radius: 4px;">
		                    <div>
		                        <div>
		                            <div style="font-size: .3rem;color: #000;font-weight: bold;"><?php echo $val['title']; ?></div>
		                            <div style="font-size: .24rem;color: #595757;margin-top: .2rem;letter-spacing: 2px;">大/半糖/热</div>
		                        </div>
		                        <div style="display: flex;align-items: center;">
		                            <div style="font-size: .24rem;color: #595757;">X<?php echo $val['num']; ?>	</div>
		                            <div style="margin-left: .94rem;font-size: .36rem;color: #000;font-weight: bold;">¥<?php echo $val['money']; ?></div>
		                        </div>
		                    </div>
		                </div>
					<?php } ?>
				<?php }else{ ?>
					<div class="list-log1">
	                    <img src="<?php echo $goods['img']; ?>" style="width: 1.1rem;height: 1.1rem;border-radius: 4px;">
	                    <div>
	                        <div>
	                            <div style="font-size: .3rem;color: #000;font-weight: bold;"><?php echo $goods[0]['title'] ?></div>
	                            <!-- <div style="font-size: .24rem;color: #595757;margin-top: .2rem;letter-spacing: 2px;">大/半糖/热</div> -->
	                        </div>
	                        <div style="display: flex;align-items: center;">
	                            <div style="font-size: .24rem;color: #595757;">X<?php echo $order[0]['number'] ?></div>
	                            <div style="margin-left: .94rem;font-size: .36rem;color: #000;font-weight: bold;">¥<?php echo $order[0]['Price'] ?></div>
	                        </div>
	                    </div>
	                </div>
				<?php } ?>


                <div class="detail-info-list">
                    <div style="font-size: .26rem;color: #595757;">订单金额</div>
                    <div style="font-size: .3rem;color: #ff8c14;">¥<?php echo $deta[0]['o_money'] ?></div>
                </div>
                <div class="detail-info-list">
                    <div style="font-size: .26rem;color: #595757;">服务费<span style="font-size: .22rem;color: #ff8c14;">（6‰）</span></div>
                    <div style="font-size: .3rem;color: #ff8c14;">-¥<?php echo $deta[0]['service_fee'] ?></div>
                </div>
                <div class="detail-info-list">
                    <div style="font-size: .26rem;color: #595757;">操作费<span style="font-size: .22rem;color: #ff8c14;">（3％）</span></div>
                    <div style="font-size: .3rem;color: #ff8c14;">-¥<?php echo $deta[0]['operation_fee'] ?></div>
                </div>
                <div style="margin-top: .5rem;color: #000;text-align: right;">
                    <span style="font-size: .3rem;">实际收入</span>
                    <span style="font-size: .36rem;margin-left: .15rem;">¥<?php echo $deta[0]['income_money'] ?></span>
                </div>
            </div>
            <div class="kong" style="height: .35rem;"></div>
            <div style="padding: 0 .6rem;">
                <div style="margin-top: .35rem;font-size: .24rem;color: #7d7d7d;">订单编号：<?php echo $order[0]['ordernum'] ?></div>
                <div style="margin-top: .35rem;font-size: .24rem;color: #7d7d7d;">下单时间：<?php echo date('Y-m-d H:i', $order[0]['start_time']); ?></div>
                <div style="margin-top: .35rem;font-size: .24rem;color: #7d7d7d;">核销时间：<?php echo date('Y-m-d H:i', $deta[0]['hexiao_time']); ?></div>
            </div>
        </div>
    </div>
</body>
</html>
<script>
    new Vue({
        el:"#app",
        data:{
            date: '',
            show: true,
            list: [1,1,1,1,1,1]
        },
        methods: {
            back(){
                window.history.back()
            },
            showRiLi(){
                console.log(1)
                this.show = true
            },
            formatDate(date) {
                return `${date.getMonth() + 1}/${date.getDate()}`;
            },
            onConfirm(date) {
                this.show = false;
                this.date = this.formatDate(date);
            },
        },
        mounted () {
            // console.log(this.show)
        }
    })

    Vue.use(
        vant.Calendar
    );
</script>
<script>
    (function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
        var clientWidth = docEl.clientWidth
        if (!clientWidth) return
        if (clientWidth >= 750) {
            docEl.style.fontSize = '100px'
        } else {
            docEl.style.fontSize = 100 * (clientWidth / 750) + 'px'
        }
        }
    if (!doc.addEventListener) return
    win.addEventListener(resizeEvt, recalc, false)
    doc.addEventListener('DOMContentLoaded', recalc, false)
    })(document, window)
</script>
